//
//  CommentContentView.m
//  YJRenter
//
//  Created by 文彬 on 2018/7/9.
//  Copyright © 2018年 文彬. All rights reserved.
//

#import "CommentContentView.h"
#import "WBTextView.h"

@interface CommentContentView()

@property (strong, nonatomic) WBTextView *inputTxtView;
@property (strong, nonatomic) UIView *lineView;
@property (strong, nonatomic) UIButton *hideNameBtn;
@property (strong, nonatomic) UILabel *messLabel;

@end

@implementation CommentContentView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)init{
    self = [super init];
    if (self) {
        
        [self initPageControl];
    }
    return self;
}

- (void)initPageControl{
    [self addSubview:self.inputTxtView];
    [self addSubview:self.lineView];
    [self addSubview:self.hideNameBtn];
    [self addSubview:self.messLabel];
   
}

- (void)layoutSubviews{
    [self.inputTxtView makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@10);
        make.right.equalTo(@-10);
        make.bottom.equalTo(@-80);
    }];
    
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(@0);
        make.height.equalTo(@0.5);
        make.bottom.equalTo(@-50);
    }];
    
    [self.hideNameBtn makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@60);
        make.height.equalTo(@30);
        make.left.equalTo(@10);
        make.bottom.equalTo(@-10);
    }];
    
    [self.messLabel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@-10);
        make.height.equalTo(@30);
        make.width.equalTo(@200);
        make.centerY.equalTo(self.hideNameBtn.centerY);
    }];
}
#pragma mark getter
- (WBTextView*)inputTxtView{
    if (_inputTxtView==nil) {
        _inputTxtView = [[WBTextView alloc]init];
        _inputTxtView.font = [UIFont systemFontOfSize:15];
        _inputTxtView.textColor = kTitleColor;
        _inputTxtView.placeholder = @"写下您的评价吧！";
    }
    return _inputTxtView;
}

- (UIView*)lineView{
    if (_lineView==nil) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = kLineColor;
    }
    return _lineView;
}

- (UIButton*)hideNameBtn{
    if (_hideNameBtn==nil) {
        _hideNameBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_hideNameBtn setTitle:@"匿名" forState:UIControlStateNormal];
        [_hideNameBtn setImage:[UIImage imageNamed:@"CheckSelected"] forState:UIControlStateNormal];
        _hideNameBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 30);
        _hideNameBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [_hideNameBtn setTitleColor:kTitleColor forState:UIControlStateNormal];
    }
    return _hideNameBtn;
}

- (UILabel*)messLabel{
    if (_messLabel==nil) {
        _messLabel = [[UILabel alloc]init];
        _messLabel.font = [UIFont systemFontOfSize:14];
        _messLabel.textColor = kTitleColor;
        _messLabel.text = @"您写的评价会已匿名形式展示";
        _messLabel.textAlignment = NSTextAlignmentRight;
    }
    return _messLabel;
}
@end
